package mianshi.consumer;

import java.util.LinkedList;
import java.util.Queue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class Test {

    public static void main(String[] args) {
        Queue<String> msg = new LinkedList<>();
        int maxSize = 10;
        Lock lock = new ReentrantLock();
        Condition condition = lock.newCondition();
        Consumer consumer = new Consumer(msg, maxSize, lock, condition);
        Producer producer = new Producer(msg, maxSize, lock, condition);

        Thread t1 = new Thread(consumer);
        Thread t2 = new Thread(producer);
        t1.start();
        t2.start();

    }

}
